package com.xk857.school.controller;


import com.xk857.entities.TourismComment;
import com.xk857.school.req.TourismCommentAdd;
import com.xk857.school.service.ITourismCommentService;
import com.xk857.util.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 星空小屋-组团旅行评论表 前端控制器
 * </p>
 *
 * @author CV大魔王
 * @since 2021-05-02
 */
@Api(value = "组团评论管理接口", tags = "组团评论管理接口")
@RestController
@RequestMapping("/pri/tourism/comment")
public class TourismCommentController {


    @Autowired
    private ITourismCommentService tourismCommentService;


    @ApiOperation("通过id级联删除评论")
    @DeleteMapping("/{id}")
    public Result deleteById(@PathVariable String id) {
        return tourismCommentService.deleteById(id);
    }


    @ApiOperation("用户发表评论")
    @PostMapping("/add")
    public Result addByUser(@RequestBody TourismCommentAdd comment) {
        return tourismCommentService.addByUser(comment);
    }


    @ApiOperation("通过id级联删除评论")
    @PostMapping
    public Result add(TourismComment comment) {
        return tourismCommentService.add(comment);
    }

}
